package com.yuke.cloud.service.uac;

/*
 * <p>Company: Copyright (c) 2018. yuke All Rights Reserved. </br> </p>
 * <p>Title：yuke-mall </br> </p>
 * <p>com.yuke.cloud.service.uac Description TODO </br> </p>
 * @Author wg
 * @Date   2019/12/25 11:26
 */

import com.yuke.cloud.service.uac.entity.AccUser;
import com.yuke.cloud.service.uac.service.AccUserService;
import com.yuke.cloud.service.uac.utils.Md5Util;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import java.util.List;

@RunWith(SpringRunner.class)
@SpringBootTest// 指定启动类
@Slf4j
public class test2 {
    @Autowired
    private AccUserService accUserService;

    @Test
    public void  test21(){
        List<AccUser> accUserList = accUserService.selectAll();
        for(AccUser accUser : accUserList){
            String mobileNo = accUser.getMobile();
            if (mobileNo != null && mobileNo.length() == 11){

                accUser.setPayPassword(Md5Util.encrypt(mobileNo.substring(5,11)));
                accUserService.update(accUser);
            }
        }
    }

}
